# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Andy Weidenbaum <archbaum@gmail.com>

pkgname=python-plyvel
pkgver=1.5.0
pkgrel=2
pkgdesc="A fast and feature-rich Python interface to LevelDB"
arch=('loong64' 'x86_64')
license=('BSD')
url="https://github.com/wbolster/plyvel"
depends=('leveldb' 'python')
makedepends=('cython' 'python-setuptools')
checkdepends=('python-pytest-runner')
source=("https://pypi.io/packages/source/p/plyvel/plyvel-$pkgver.tar.gz")
sha512sums=('3f12b1d17a7b4b52fc2874b091a7378f3e8c0f895a3993f86ce6a686f7f94d28b585c5e6aa9b48ebb7d9106cae2b148aa15a87f07dfb232a0678ed151d8e09c1')

prepare() {
  # Shipped egg-info has wrong permission etc
  cd plyvel-$pkgver
  make clean
}

build() {
  cd plyvel-$pkgver
  make cython
  python setup.py build
}

check() {
  cd plyvel-$pkgver
  python setup.py pytest
}

package() {
  cd plyvel-$pkgver
  python setup.py install --root="$pkgdir" --optimize=1
  install -Dm644 LICENSE.rst "$pkgdir"/usr/share/licenses/$pkgname/LICENSE.rst
}
